{extend name="layout/layout" /}

{block name="pagecss"}
<link href="__STATIC__/admin/pages/css/group.css" rel="stylesheet" type="text/css" />
{/block}

{block name="content"}
<div class="row">
    <div class="col-xs-12">
        <div class="box box-success">
            <div class="box-header with-border">
                <div class="row">
                    <form id="searchForm" class="form">
                        <div class="col-md-3" id="store">
                            {if condition="$admin.roleType == 2 "}  <!-- 店员登录 -->
                            <select  name="storeId" class="form-control" disabled>
                                {volist name="store" id="vo"}
                                <option value="{$vo.id}" {eq name="vo.id" value="$admin.storeId"}selected{/eq}  ><span>{$vo.name}</span></option>
                                {/volist}
                            </select>
                            {else /}
                            <select  name="storeId" class="form-control" onchange="changeStore(this)">
                                {volist name="store" id="vo"}
                                <option value="{$vo.id}" {eq name="vo.id" value="$storeId"}selected{/eq}  ><span>{$vo.name}</span></option>
                                {/volist}
                            </select>
                            {/if}
                        </div>
                        <div class="col-md-3">
                            <div class="grid-btn" id="search">
                                <div class="col-md-5">
                                    <select name="search" class="form-control">
                                        <option value="sort"><span>默认</span></option>
                                        <option value="create_time"><span>最新</span></option>
                                        <option value="sell"><span>热卖</span></option>
                                        <option value="recommendation"><span>首页推荐</span></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-tools pull-right">
                    <div class="btn-group">
                        <button type="button" id="btn_new_role" class="btn btn-primary"><span class="glyphicon glyphicon-plus-sign"></span> 添加拼团</button>
                        <button type="button" id="btn_get_record" class="btn bg-navy" style="margin-left: 10px;"></span>查看拼团记录</button>
                    </div>
                </div>
            </div>
            <div class="box-body">
                <form class="form-horizontal form">
                    <div class="table-responsive">
                        <div class="tabs" id="groupProduct">
                            <div id="menu1" class="tab-pane active in fade">
                                <input type="hidden" name="tagProduct" value="">
                                <table class="table table-striped table-bordered table-hover table-checkable order-column" id="storeproduct_table">
                                </table>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 选择门店商品弹出框 -->
<div class="modal fade" id="storeproduct" data-backdrop="static" data-keyboard="false" >
    <div class="modal-dialog" style="width:800px; height: 520px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">x</button>
                <h4 class="modal-title">选择商品</h4>
            </div>
            <div class="modal-body">
                <div class="grid-btn" id="search2">
                    <div class="col-md-5">
                        <select name="typeId" class="form-control">
                            <option value=""><span>所有商品类目</span></option>
                            {volist name="type" id="vo"}
                            <option value="{$vo.id}" >{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <table class="table" id="product_table">
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" id="" class="btn default btn-confrom-product" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="pagescript"}
<script>
    var storeList_url = "{:url('admin/group/indexApi')}";  //获取本门店所有的拼团商品
    var layer_product = "{:url('admin/layer/product')}";  //获取本门店所有商品列表
    var groupDel_url = "{:url('admin/group/groupDel')}";  //删除选中的拼团商品
    var setGroup_url = "{:url('admin/group/setGroup')}";  //为选中商品设置拼团价
    var recommend_url = "{:url('admin/group/recommend')}";  //设置首页推荐
    var record_url = "{:url('admin/group/recordList')}";   //查看拼团记录

    function changeStore(e) {  //切换门店
        var id = e.value;
        location.href="{:url('admin/group/index')}"+'?storeId='+id;
    }
</script>
<script src="__STATIC__/admin/js/include.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/group.js" type="text/javascript"></script>
{/block}